]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Show the panel above the screenshield when locked
authorGiovanni Campagna <gcampagna@src.gnome.org>
Tue, 22 May 2012 22:27:06 +0000 (00:27 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 21 Jul 2012 13:40:28 +0000 (15:40 +0200)
Track locked status and use it to provide a reduced version of
the panel in the locked screen. Accessibility, input sources and
volume menus are preserved, without the link to the control center.
Network, battery and user menu are reduced to pure indicators,
with no menu.
This is similar to the design but not exactly, because designers
in IRC said that network needs more analysis before exposing, and
because the design didn't account for a11y and IM (so the one menu
metaphor is not really appropriate).

https://bugzilla.gnome.org/show_bug.cgi?id=619955

js/ui/layout.js
js/ui/panel.js
js/ui/panelMenu.js
js/ui/popupMenu.js
js/ui/status/accessibility.js
js/ui/status/bluetooth.js
js/ui/status/keyboard.js
js/ui/status/network.js
js/ui/status/power.js
js/ui/status/volume.js
js/ui/userMenu.js

index 446b590a0c61b3bc865fa88c22e32ebb3f7a4cb9..acf6e1f9ffcf9d877b3d76543f173742aaa6acaa 100644 (file)
@@ -33,6 +33,12 @@ const LayoutManager = new Lang.Class({
 
         this._chrome = new Chrome(this);
 
+        this.screenShieldGroup = new St.Widget({ name: 'screenShieldGroup',
+                                                 visible: false,
+                                                 clip_to_allocation: true,
+                                               });
+        this.addChrome(this.screenShieldGroup);
+
         this.panelBox = new St.BoxLayout({ name: 'panelBox',
                                            vertical: true });
         this.addChrome(this.panelBox, { affectsStruts: true,
@@ -40,12 +46,6 @@ const LayoutManager = new Lang.Class({
         this.panelBox.connect('allocation-changed',
                               Lang.bind(this, this._updatePanelBarriers));
 
-        this.screenShieldGroup = new St.Widget({ name: 'screenShieldGroup',
-                                                 visible: false,
-                                                 clip_to_allocation: true,
-                                               });
-        this.addChrome(this.screenShieldGroup);
-
         this.trayBox = new St.BoxLayout({ name: 'trayBox' }); 
         this.addChrome(this.trayBox);
         this.trayBox.connect('allocation-changed',
index 648a67790ac9558e5d7f8a3b5c6f6835ee054e28..82c9996621b3d3d94e954900838f6b644343360e 100644 (file)
@@ -467,6 +467,13 @@ const AppMenuButton = new Lang.Class({
         this._sync();
     },
 
+    setLockedState: function(locked) {
+        if (locked)
+            this.hide();
+        else
+            this._sync();
+    },
+
     _sync: function() {
         let tracker = Shell.WindowTracker.get_default();
         let focusedApp = tracker.focus_app;
@@ -910,6 +917,8 @@ const Panel = new Lang.Class({
             this.actor.remove_style_class_name('in-overview');
         }));
 
+        Main.screenShield.connect('lock-status-changed', Lang.bind(this, this._onLockStateChanged));
+
         this._menus = new PopupMenu.PopupMenuManager(this);
 
         this._leftBox = new St.BoxLayout({ name: 'panelLeft' });
@@ -1135,7 +1144,7 @@ const Panel = new Lang.Class({
 
         this._statusArea[role] = indicator;
         let destroyId = indicator.connect('destroy', Lang.bind(this, function(emitter) {
-            this._statusArea[role] = null;
+            delete this._statusArea[role];
             emitter.disconnect(destroyId);
         }));
 
@@ -1165,4 +1174,16 @@ const Panel = new Lang.Class({
         if (box && box._delegate instanceof PanelMenu.ButtonBox)
             box.destroy();
     },
+
+    _onLockStateChanged: function(shield, locked) {
+        if (this._activitiesButton)
+            this._activitiesButton.setLockedState(locked);
+        if (this._appMenu)
+            this._appMenu.setLockedState(locked);
+        if (this._dateMenu)
+            this._dateMenu.setLockedState(locked);
+
+        for (let id in this._statusArea)
+            this._statusArea[id].setLockedState(locked);
+    },
 });
index 0d8c84aafe7944196ba49d60e696638f6c803ce6..f1800694b85391c5833a6951e2d8b0aae2caa628 100644 (file)
@@ -145,6 +145,13 @@ const Button = new Lang.Class({
         }
     },
 
+    setLockedState: function(locked) {
+        // default behaviour is to hide completely
+        if (locked)
+            this.menu.close();
+        this.actor.visible = !locked;
+    },
+
     _onButtonPress: function(actor, event) {
         if (!this.menu)
             return;
index beb26cde438253ffa055c13cf6c7b5953e0cc216..7570d6ebcb5c857f6138a8ec459ce229b6a329f4 100644 (file)
@@ -872,6 +872,7 @@ const PopupMenuBase = new Lang.Class({
 
         this._activeMenuItem = null;
         this._childMenus = [];
+        this._settingsActions = { };
     },
 
     addAction: function(title, callback) {
@@ -899,9 +900,19 @@ const PopupMenuBase = new Lang.Class({
                            Main.overview.hide();
                            app.activate();
                        });
+
+        this._settingsActions[desktopFile] = menuItem;
+
         return menuItem;
     },
 
+    setSettingsVisibility: function(visible) {
+        for (let id in this._settingsActions) {
+            let item = this._settingsActions[id];
+            item.actor.visible = visible;
+        }
+    },
+
     isEmpty: function() {
         return this.box.get_n_children() == 0;
     },
index 20c54c6e1fe5e6c06a38da9ce01f81178582e70c..35cd6fece3a0709e5dd9dfb450736a23967b084b 100644 (file)
@@ -83,6 +83,10 @@ const ATIndicator = new Lang.Class({
         this.menu.addSettingsAction(_("Universal Access Settings"), 'gnome-universal-access-panel.desktop');
     },
 
+    setLockedState: function(locked) {
+        this.menu.setSettingsVisibility(!locked);
+    },
+
     _buildItemExtended: function(string, initial_value, writable, on_set) {
         let widget = new PopupMenu.PopupSwitchMenuItem(string, initial_value);
         if (!writable)
index 2d3b9b84b2d923cf6d29272cf212819c8a30cb03..b68b8433c96a8f32cf4ce0bf0636b9d53fe11f1d 100644 (file)
@@ -92,6 +92,11 @@ const Indicator = new Lang.Class({
         this._applet.connect('cancel-request', Lang.bind(this, this._cancelRequest));
     },
 
+    setLockedState: function(locked) {
+        this._isLocked = locked;
+        this._updateKillswitch();
+    },
+
     _updateKillswitch: function() {
         let current_state = this._applet.killswitch_state;
         let on = current_state == GnomeBluetoothApplet.KillswitchState.UNBLOCKED;
@@ -106,7 +111,7 @@ const Indicator = new Lang.Class({
             /* TRANSLATORS: this means that bluetooth was disabled by hardware rfkill */
             this._killswitch.setStatus(_("hardware disabled"));
 
-        this.actor.visible = has_adapter;
+        this.actor.visible = !this._isLocked && has_adapter;
 
         if (on) {
             this._discoverable.actor.show();
index 6d3b04196f47338b5753e55ce30a720efbd8df2f..ce32d0192a8eb13367363a95c4d602980ca6cdb0 100644 (file)
@@ -175,11 +175,16 @@ const InputSourceIndicator = new Lang.Class({
         // option if need arises.
         if (Main.sessionMode.allowSettings) {
             this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
-            this.menu.addAction(_("Show Keyboard Layout"), Lang.bind(this, this._showLayout));
+            this._showLayoutItem = this.menu.addAction(_("Show Keyboard Layout"), Lang.bind(this, this._showLayout));
         }
         this.menu.addSettingsAction(_("Region and Language Settings"), 'gnome-region-panel.desktop');
     },
 
+    setLockedState: function(locked) {
+        this._showLayoutItem.actor.visible = !locked;
+        this.menu.setSettingsVisibility(!locked);
+    },
+
     _currentInputSourceChanged: function() {
         let nVisibleSources = Object.keys(this._layoutItems).length;
         if (nVisibleSources < 2)
index 5a3210bfb9b55fd7c0b91b37f09d5ffe91405cdd..301ebcb01eab8ca02a6444786b16a22e223d26ae 100644 (file)
@@ -1698,6 +1698,15 @@ const NMApplet = new Lang.Class({
         this._primaryIcon.icon_name = iconName;
     },
 
+    setLockedState: function(locked) {
+        // FIXME: more design discussion is needed before we can
+        // expose part of this menu
+
+        if (locked)
+            this.menu.close();
+        this.actor.reactive = !locked;
+    },
+
     _ensureSource: function() {
         if (!this._source) {
             this._source = new MessageTray.Source(_("Network Manager"),
index 978d009b959f97112df919f1543fc5db5e4d5205..8d2e00bfd8fa7bc16d977ebb6433b6ab1ee0d4ed 100644 (file)
@@ -80,6 +80,12 @@ const Indicator = new Lang.Class({
         this._devicesChanged();
     },
 
+    setLockedState: function(locked) {
+        if (locked)
+            this.menu.close();
+        this.actor.reactive = !locked;
+    },
+
     _readPrimaryDevice: function() {
         this._proxy.GetPrimaryDeviceRemote(Lang.bind(this, function(result, error) {
             if (error) {
index 6951cb167dcac2a676c635139edc817cb9ad2b89..9a085a24bb281852f8470d6b8f352ff65f9b8c1b 100644 (file)
@@ -62,6 +62,10 @@ const Indicator = new Lang.Class({
         this._control.open();
     },
 
+    setLockedState: function(locked) {
+        this.menu.setSettingsVisibility(!locked);
+    },
+
     _onScrollEvent: function(actor, event) {
         let direction = event.get_scroll_direction();
         let currentVolume = this._output.volume;
index ff4e58024d44c171ad94068fd2a49de0ac2d582e..eea4146490770a3f31de0066db02cfdf263dfa6e 100644 (file)
@@ -538,6 +538,12 @@ const UserMenuButton = new Lang.Class({
         this._upClient.connect('notify::can-suspend', Lang.bind(this, this._updateSuspendOrPowerOff));
     },
 
+    setLockedState: function(locked) {
+        if (locked)
+            this.menu.close();
+        this.actor.reactive = !locked;
+    },
+
     _onDestroy: function() {
         this._user.disconnect(this._userLoadedId);
         this._user.disconnect(this._userChangedId);